//
//  TestEventManager.swift
//  Runner
//
//  Created by 李旭峰 on 2020/10/10.
//

import Foundation
//import flutter_boost

class TestEventManager: NSObject {
    static let `default` = TestEventManager()
    private(set) var eventChannelMap:[NSObject:FlutterEventChannel] = [:]
    var eventSink:FlutterEventSink?;
    
    func initEventChannel(with kChannelMessenger:NSObject){
//        let messenger = FlutterBoostPlugin.sharedInstance().currentViewController()
//        let eventChannel = FlutterEventChannel(name: "App/Event/Channel", binaryMessenger: messenger as! FlutterBinaryMessenger)
//        eventChannel.setStreamHandler(self)
//        self.eventChannelMap[kChannelMessenger] = eventChannel
    }
}

extension TestEventManager : FlutterStreamHandler {
    func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
        self.eventSink = events
        return nil
    }
    
    func onCancel(withArguments arguments: Any?) -> FlutterError? {
        return nil
    }
}
